import { query } from '@/api/language'
import { getToken, setToken, removeToken } from '@/utils/auth'
import { resetRouter } from '@/router'
import { Encrypt } from '@/utils/Secret.js'

const getDefaultState = () => {
  return {
    token: getToken(),
    name: '',
    avatar: ''
  }
}

const state = getDefaultState()

const actions = {
    query({ commit, state }) {
        return new Promise((resolve, reject) => {
            query().then(response => {
            const { data } = response

            resolve(data)
          }).catch(error => {
            reject(error)
          })
        })
      },
}